<?php

function getPhongban($dv_id){
	$query = "SELECT * FROM dm_phongban WHERE dv_id = '$dv_id' ";
	global $db;
	$db->querySql($query);
	$arrPhongban = $db->fetchAssocs();
	foreach ($arrPhongban as $k=>$v){
		echo '<option value = "'.$v['pb_id'].'"';
		if(isset($_SESSION['arrNhanvien']['pb_id'])){
			if($_SESSION['arrNhanvien']['pb_id'] == $v['pb_id']){
				echo ' selected ';
			}
		}
		echo '>'.$v['pb_tenphongban'].'</option>';
	}
}



if(isset($_GET['dv'])){
	$dv_id=addslashes($_GET['dv']);
	if($dv_id != 0){
		getPhongban($dv_id);
	}else{
		echo '<option>---Chọn phòng ban---</option>';
	}
	
}